import { defineConfig } from 'vite'
import fsp from 'node:fs/promises';
import { constants } from 'node:fs'; // 从 fs 模块导入 constants

import vue from '@vitejs/plugin-vue'

import path from 'node:path'
export default defineConfig(({mode, command}) => {
    console.log(mode)
    if (command === 'serve') {
        console.log('is serve')
    } else {
        console.log('is build')
    }
    return {
        resolve: {
            alias: {
                '@': path.join(__dirname, 'src')     // 这样配置后 @ 可以代表 /src
            }
        },
        server: {
            port: 8080,
            open: true,
            host: '0.0.0.0', // 允许局域网访问ss

        },
        build: {
            outDir: 'web',
        },
        plugins: [
            vue()
        ]
    }
})